var uniqueId = function () {
    var id = 0;
    return function() {
        return id++;
    }
}();

Land = new Class({
    Implements: Events,
    initialize: function(options) {
        this.owner = 'board';
        this.points = 0;
        Object.append(this, options);
        
    },
    getId: function() {
        return this.id;
    },
    getX: function() {
        return this.x;
    },
    getY: function() {
        return this.y;
    },
    getWidth: function() {
        return this.width;
    },
    getHeight: function() {
        return this.height;
    },
    getType: function() {
        return this.type;
    },
    getOwner: function() {
        return this.owner;
    },
    setOwner: function(owner) {
        this.owner = owner;
    },
    getPoints: function() {
        return this.points;
    },
    addPoints: function(points) {
        this.points += points;
        this.fireEvent('points: change');
    },
    removePoints: function(points) {
        if(this.points - points < 0) this.points = O;
        else this.points -= points;
        this.fireEvent('points: change');
    }
});

Board = new Class({
    initialize: function(plateau) {
        this.lands = [];
        var self = this;
        plateau.each(function(land) {
            var options = {
                'id'            : uniqueId(),
                'x'             : land.x,
                'y'             : land.y,
                'width'         : land.width,
                'height'        : land.height,
                'type'          : land.type
            }
            var land = new Land(options);
            self.lands.push(land);
        });
    },
    getLands: function() {
        return this.lands;
    },
    getNeighbors: function(land) {
        
    }
});